// 获取新闻列表的API端点
import { apiRequest, handleApiError, getTypedQuery } from '../../utils/apiClient';
import { getQuery } from 'h3';

export default defineEventHandler(async (event) => {
  try {
    // 从请求中获取查询参数
    const query = getQuery(event);
    const params = {
      pageindex: Number(query.pageindex) || 1,
      num: Number(query.num) || 8,
      cateid: query.cateid as string
    }; 
    // 发送请求
    const data = await apiRequest('news.information.list', params); 
    return data;
  } catch (error) {
    return handleApiError(error, []);
  }
});